package com.ysccc.shares.web.vo;

import java.io.Serializable;
import java.util.List;

import org.springframework.data.domain.Page;

import com.ysccc.shares.entity.Shares;
import com.ysccc.shares.entity.SharesDaily;

import lombok.Data;

@Data
public class SharesDailyPageVo implements Serializable {

	private static final long serialVersionUID = 1L;

	private SharesVo shares;
	
	private List<SharesDailyVo> dailies;
	
	private int page;
	
	private int size;
	
	private int total;
	
	private int totalPage;

	public SharesDailyPageVo(Shares shares, Page<SharesDaily> dailies) {
		super();
		this.shares = new SharesVo(shares);
		if (dailies!= null && !dailies.isEmpty()) {
			this.dailies = dailies.map(SharesDailyVo::new).getContent();
		}
		if (dailies!= null) {
			this.page = dailies.getNumber();
			this.size = dailies.getSize();
			this.total = dailies.getNumberOfElements();
			this.totalPage = dailies.getTotalPages();
		}
	}

	public SharesDailyPageVo() {
		super();
	}
}
